package org.apache.dubbo.registry;

import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;

public class RegistryFactory$Adaptive implements RegistryFactory {
    public Registry getRegistry(org.apache.dubbo.common.URL arg0) {
        if (arg0 == null) { throw new IllegalArgumentException("url == null"); }
        org.apache.dubbo.common.URL url = arg0;
        String extName = url.getProtocol();
        if (extName == null) {
            throw new IllegalStateException(
                "Failed to get extension (org.apache.dubbo.registry.RegistryFactory) name from url (" + url.toString()
                    + ") use keys([protocol])");
        }
        ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
            RegistryFactory.class);
        RegistryFactory extension =
            (RegistryFactory) scopeModel.getExtensionLoader(RegistryFactory.class)
            .getExtension(extName);
        return extension.getRegistry(arg0);//根据协议获取对应直接扩展类
    }
}
